// 在 com.competition.commgr.constants 包下创建
package com.competition.commgr.constants;

import java.util.HashMap;
import java.util.Map;

public class ReviewStepConstants {

    // 步骤代码（存储用）
    public static final String COLLEGE = "college";
    public static final String TRAINING_CENTER = "training_center";

    // 步骤显示名称（展示用）
    public static final String COLLEGE_NAME = "学院审核";
    public static final String TRAINING_CENTER_NAME = "实训中心审核";

    // 步骤映射
    private static final Map<String, String> STEP_MAP = new HashMap<>();
    private static final Map<String, String> REVERSE_STEP_MAP = new HashMap<>();

    static {
        STEP_MAP.put(COLLEGE, COLLEGE_NAME);
        STEP_MAP.put(TRAINING_CENTER, TRAINING_CENTER_NAME);

        REVERSE_STEP_MAP.put(COLLEGE_NAME, COLLEGE);
        REVERSE_STEP_MAP.put(TRAINING_CENTER_NAME, TRAINING_CENTER);
    }

    /**
     * 规范化步骤（输入可能是中文或英文，统一输出英文）
     */
    public static String normalizeStep(String step) {
        if (step == null) return null;

        // 如果是中文名称，转换为英文代码
        if (COLLEGE_NAME.equals(step)) {
            return COLLEGE;
        } else if (TRAINING_CENTER_NAME.equals(step)) {
            return TRAINING_CENTER;
        }

        // 已经是英文的直接返回
        return step;
    }

    /**
     * 获取步骤显示名称
     */
    public static String getDisplayName(String stepCode) {
        return STEP_MAP.getOrDefault(stepCode, stepCode);
    }

    /**
     * 检查是否为培训中心步骤
     */
    public static boolean isTrainingCenterStep(String step) {
        return TRAINING_CENTER.equals(normalizeStep(step));
    }
}